package com.gdwProject.tankgame3;

/**
 * @author 关道伟
 * @version 1.0
 */
public class MyTank extends Tank {
    Shot shot = null;

    public MyTank(int x, int y) {
        super(x, y);
    }

    //射击
    public void shotEnemyTank() {
        //根据自己tank的位置与方向创建子弹
        switch (this.getDirect()) {
            case 0:
                shot = new Shot(getX() + 20, getY(), 0);
                break;
            case 1:
                shot = new Shot(getX() + 60, getY() + 20, 1);
                break;
            case 2:
                shot = new Shot(getX() + 20, getY() + 60, 2);
                break;
            case 3:
                shot = new Shot(getX(), getY() + 20, 3);
                break;
        }
        //创建好子弹线程后 启动线程
        new Thread(shot).start();
    }
}
